package cn.wolfcode.luowowo.enum1;

import cn.wolfcode.luowowo.domain.Strategy;
import cn.wolfcode.luowowo.util.Consts;
import lombok.Getter;

import java.util.Calendar;
import java.util.Date;

@Getter
public enum RedisKeys {
    //访问用户
    USER("user",-1L),
    //短信验证码的redis 的key对象
    VERIFY_CODE("verify_code", Consts.VERIFY_CODE_VAI_TIME * 60L),
    LOGIN_TOKEN("login_token",Consts.USER_INFO_TOKEN_VAI_TIME * 60L),
    //攻略统计信息
    STRATEGY_STATIS_VO("strategy_statis_vo",-1L),
    STRATEGY_FAVORNUM("strategy_favornum",-1L),
    STRATEGY_THUMBUP("strategy_thumbup",-1L);

    private String prefix;//key前缀
    private Long time;//key存活时间
    //私有化的构造器
    private RedisKeys(String prefix,Long time){
        this.prefix = prefix;
        this.time = time;
    }
    //拼接方法
    public  String join(String...value){
        StringBuilder sb = new StringBuilder(100);
        sb.append(this.prefix);
        for (String s :value) {
            sb.append(":").append(s);
        }
        return sb.toString();
    }

}
